.uploaded-image-preview {
  position: relative;
  max-width: 400px;
  width: 100%;
  height: 80px;
  margin-bottom: 0.5em;
  box-sizing: border-box;
  border-radius: var(--d-input-border-radius);
  background-origin: content-box;
  background-clip: content-box;

  .meta {
    display: none;
  }

  .placeholder-overlay {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
    pointer-events: none;
    box-shadow: inset 0 0 0 var(--space-1) var(--secondary);
  }

  &:hover .expand-overlay,
  &:focus-within .expand-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

.has-image {
  .uploaded-image-preview {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left center;
    border: 1px solid var(--primary-low-mid);
    padding: var(--space-1);

    &:focus,
    &:focus-within {
      border-color: var(--tertiary);
      outline: 2px solid var(--tertiary);
      outline-offset: -2px;
    }
  }

  .image-upload-controls {
    margin-top: var(--space-2);
  }
}

.no-image .uploaded-image-preview {
  position: relative;
  border: 1px dashed var(--primary-medium);
  background-color: var(--primary-very-low);

  &:focus,
  &:focus-within {
    border-color: var(--tertiary);
    outline: 2px dashed var(--tertiary);
    outline-offset: -2px;
  }

  .image-upload-controls {
    height: 100%;
    background-color: var(--primary-very-low);
    transition: background 0.25s;
    border-radius: var(--d-input-border-radius);

    &:hover {
      background-color: var(--tertiary-very-low);
    }

    label {
      display: flex;
      font-weight: normal;
      color: var(--primary-very-high);
      width: 100%;
      height: 100%;
      box-sizing: border-box;
      border-radius: var(--d-input-border-radius);

      svg {
        color: var(--primary-high);
      }
    }
  }
}

.expand-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.progress-status {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;

  .progress-bar-container {
    --d-border-radius: 10px;
    background: var(--primary-low-mid);
    border-radius: var(--d-border-radius);
    height: 5px;
    position: relative;

    .progress-bar {
      border-radius: var(--d-border-radius);
      height: 100%;
      background: var(--tertiary);
      transition: width 0.3s ease;
      position: absolute;
      left: 0;
      top: 0%;
    }
  }

  span {
    font-size: var(--font-down-2);
    margin-top: 8px;
    display: block;
    text-align: center;
    color: var(--primary-high);
  }
}

.hidden-upload-field {
  visibility: hidden;
  position: absolute;
}
